<template>
  <div>
    <!-- 表格操作项 start  -->
    <Button v-for="(item, index) in tableBtn"
            :key="index"
            type="primary"
            :icon="item.icon"
            class="ivu-mr-8"
            @click="tableTopOperate(item.name)">{{ item.label }}</Button>
    <!-- <Button icon="md-list"
            class="ivu-ml-8"
            v-show="tableBatchBtns && tableBatchBtns.length>0 && tableSelectData &&tableSelectData.length">批量操作</Button> -->
    <Dropdown class="ivu-ml-8"
              v-show="tableSelectData && tableSelectData.length>0"
              @on-click="handleClickItem">
      <Button>更多操作
        <Icon type="ios-arrow-down" /></Button>
      <DropdownMenu slot="list">
        <DropdownItem v-for="(item, index) in tableBatchBtns"
                      :key="index"
                      :name="item.name">{{item.label}}</DropdownItem>
      </DropdownMenu>
    </Dropdown>
    <!-- 表格操作项 end  -->
  </div>
</template>
<script>
    import { ApiRequest } from '@api/basePage';
    import dynamictablebtns from '@/mixins/dynamictablebtns'; // 混入通用代码
    export default {
        mixins: [
            dynamictablebtns
        ],
        data () {
            return {
            }
        },
        created () { },
        methods: {
            // table 操作列点击事件
            handleClickItem (name) {
                if (name === 'chuli') {
                    this.$Modal.confirm({
                        title: '批量处理',
                        content: '确定处理该信息吗？',
                        onOk: () => {
                            let data = {
                                uuid: this.getUuids()
                            }
                            // 开始请求商品列表
                            ApiRequest(this.requestApi.toProcess.url, this.requestApi.toProcess.type, data).then(res => {
                                this.$Message.success('该信息已处理');
                                this.actionsChange();
                            })
                        }
                    });
                }
            }
        }
    }
</script>
